<!doctype html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8">
  <title>{$list.sys_title}{$list.version}</title>
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  {load href="__XADMIN__/css/font.css" /}
  {load href="__XADMIN__/css/xadmin.css" /}
  {load href="__STATIC__/mayi/css/studentSearch.css" /}
  {load href="__XADMIN__/js/jquery.min.js" /}
  {load href="__XADMIN__/lib/layui/layui.js" /}
  {load href="__XADMIN__/js/xadmin.js" /}
  {load href="__XADMIN__/js/cookie.js" /}
  {load href="__XADMIN__/js/md5.min.js" /}
  <meta name="keywords" content="{php}echo $list['keywords']{/php}">
  <meta name="description" content="{php}echo $list['description']{/php}">
  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
  <script>
    // 是否开启刷新记忆tab功能
    var is_remember = false;
  </script>
  <!-- // 百度统计代码  -->
  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?6f65eecea5e089dae94d6b9cffec3623";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>
</head>

<body>
<!-- 顶部开始 -->
<div class="container">
  <div class="logo">
    <a href="/studentSearchChengji/index/index">{$list['sys_title']}</a></div>
  <ul class="layui-nav right" lay-filter="">
    <li class="layui-nav-item">
      <a href="javascript:;">{$list.banjiTitle}&nbsp;&nbsp;{$list.xingming}</a>
      <dl class="layui-nav-child">
        <!-- 二级菜单 -->
        <dd>
          <!-- <a onclick="layer.msg('修改密码，请下载后本地测试。')">
                          修改密码</a> -->
          <a onclick="xadmin.open('修改密码','/studentSearchChengji/index/editpassword','400','250')">
            修改密码</a>
        </dd>
        <dd>
          <a href="https://www.kancloud.cn/llblax/abcd/789222" target="_blank">
            系统帮助</a></dd>
        <dd>
          <a href="/login">切换帐号</a></dd>
      </dl>
    </li>
    <li class="layui-nav-item to-index">
      <a href="/login">退了</a></li>
  </ul>
</div>
{if (session('student.password') == 123) }
<blockquote class="layui-elem-quote" style="margin-top: 10px;color: red;">
  您现在使用的是默认密码，为了您的信息不被漏，请及时修改密码。
</blockquote>
{/if}
<div class="myrow" style="height: 350px;">
  <div class="x-body" style="text-align: left;">
    <div class="layui-collapse">
      <div class="layui-colla-item">
        <h2 class="layui-colla-title">筛选</h2>
        <div class="layui-colla-content layui-hidden" style="margin: 2;padding: 2;">
          <div class="layui-row">
            <form class="layui-form layui-form-pane" id="search" lay-filter="search">
              <div class="layui-form-item">
                <label for="searchval" class="layui-form-label">
                  关键字
                </label>
                <div class="layui-input-block">
                  <input type="text" id="searchval" name="searchval" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label for="xueqi_id" class="layui-form-label" class="layui-input">学期</label>
                <div class="layui-input-block">
                  <select name="xueqi_id" id="xueqi_id">
                  </select>
                </div>
              </div>
              <div class="layui-form-item">
                <label for="category_id" class="layui-form-label">考试类型</label>
                <div class="layui-input-block">
                  <select name="category_id" id="category_id">
                  </select>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label for="title" class="layui-form-label">
                    <span class="x-red">*</span>考试时间
                  </label>
                  <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="bfdate" name="bfdate" placeholder="起始：默认一年前的今天" value="{$list.data.bfdate|default=''}" autocomplete="off" lay-filter="riqi">
                  </div>
                  <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="enddate" name="enddate" placeholder="结束：默认明天" value="{$list.data.enddate|default=''}" autocomplete="off" lay-filter="riqi">
                  </div>
                </div>
                <input type="hidden" name='student_id' id='student_id' value="{$list.student_id}">
                <div class="layui-form-item" style="text-align: right;">
                  <button class="layui-btn" lay-filter="searchSubmit" lay-submit="">搜索</button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <table id="tabledemo" lay-filter="mytable" lay-size="sm"></table>
  </div>
  <div class="myrow" style="height: 50px;">
    {volist name="$list.sbj" id="vo"}
    <div class="layui-col-xs6" style="width:100%; height:400px; margin-top: 45px; margin-bottom: 45px;" id="{$vo.lieming}"></div>
    {/volist}
  </div>
  <hr class="hr20">
  <div class="myrow" style="height: 50px;">
    <div class="layui-col-md12">
      <blockquote class="layui-elem-quote layui-quote-nm">
        感谢{$list.thinks}提供技术支持。<br>
        本系统由{$list.danwei}负责管理
      </blockquote>
    </div>
  </div>
</body>
<script type="text/html" id="barDemo">
  <a class="layui-btn-xs" lay-event="detail" title="查看"><i class="layui-icon layui-icon-search"></i></a>
</script>
<script type="text/javascript">
  //config的设置是全局的
  layui.config({
    base: "__XADMIN__/js/" //假设这是你存放拓展模块的根目录
  });

  layui.use(['element', 'table', 'form', 'laydate', 'myEchart', 'createInput'], function() {
    var element = layui.element,
      table = layui.table,
      form = layui.form,
      laydate = layui.laydate,
      echart = layui.myEchart,
      cInput = layui.createInput;

    cInput.categorySelect('xueqi_id', 108);
    cInput.categorySelect('category_id', 109);

    // 设置表格初始变量
    options = {
      elem: '#tabledemo',
      toolbar: '#toolbarDemo',
      url: "/tools/onestudentchengji/oldcj",
      method: "POST", //数据接口
      page: true, //开启分页
      loading: true,
      autoSort: true,
      id: 'mytable',
      defaultToolbar: [],
      limits: [10, 25, 50, 75, 100],
      limit: 10,
      toolbar: false,
    };

    // 设置列
    options.cols = [
      [ //表头
        { field: 'id', type: 'numbers', sort: true, width: 50, title: '序号' }, { field: 'id', title: '操作', toolbar: '#barDemo', minWidth: 10 }, { field: 'kaoshiTitle', title: '考试标题', sort: true },
        {
          field: 'enddate',
          title: '考试时间',
          sort: true,
          templet: function(d) {
            var date;
            date = d.enddate.split('-');
            endate = date[1] + '-' + date[2];
            endate = d.bfdate + '～' + endate;
            return endate;
          }
        },
        { field: 'category_id', title: '考试类型', sort: true },
      ]
    ];

    var xk = '<?php echo json_encode($list["sbj"]);?>';
    xk = eval(decodeURIComponent(xk));
    for (x in xk) {
      options.cols[0].push({ field: xk[x].lieming, title: xk[x].title, minWidth: 100, sort: true });
    }
    options.cols[0].push({ field: 'avg', title: '平均分', minWidth: 100, sort: true });
    options.cols[0].push({ field: 'sum', title: '总分', minWidth: 100, sort: true });

    options.where = form.val("search");
    chengjiTable = table.render(options); //获取数据并渲染

    getDefenlv();

    function getDefenlv()
    {
      var val = form.val('search');
      for (x in xk) {
        val.subject_id = xk[x].id;
        echart.zhexian(xk[x].lieming, '/tools/onestudentchengji/xkold', val, xk[x].title);
      }
    }

    //监听行工具条
    table.on('tool(mytable)', function(obj) {
      var data = obj.data; //获得当前行数据
      var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
      var tr = obj.tr; //获得当前行 tr 的DOM对象
      switch (layEvent) {
        case 'detail': // 查看
          xadmin.open(obj.data.kaoshiTitle + '考试成绩', '/studentSearchChengji/index/read/' + obj.data.kaohao_id, '', '', true);
          break;
      };
    });


    //开始时间
    laydate.render({
      elem: '#bfdate',
      type: 'datetime',
      trigger: 'click' //采用click弹出
      ,
      format: 'yyyy-M-d' //可任意组合
      ,
    done: function(value, date, endDate) {
      form.val("search", {
        "bfdate": value,
      });
    }
  });
  //结束时间
  laydate.render({
    elem: '#enddate',
    type: 'datetime',
    trigger: 'click' //采用click弹出
      ,
      format: 'yyyy-M-d' //可任意组合
      ,
    done: function(value, date, endDate) {
      form.val("search", {
        "enddate": value,
      });
    }
  });

  // 监听筛选
  form.on('submit(searchSubmit)', function(data) {
    options.where = form.val("search");
    $('#srcmianban').removeClass("layui-show");
    table.render(options); //获取数据并渲染
    getDefenlv();
    return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
  });

});

</script>

</html>
